package my.stock.entity;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import lombok.SneakyThrows;
import org.apache.commons.io.IOUtils;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
public class Entity {

    @SneakyThrows
    @Bean
    public JSONArray subjects() {
        String content = IOUtils.toString(Entity.class.getResource("/subject.json"));
        return JSON.parseArray(content);
    }

    @SneakyThrows
    @Bean
    public JSONArray stocks() {
        String content = IOUtils.toString(Entity.class.getResource("/stock.json"));
        return JSON.parseArray(content);
    }

}
